package client.mobile;


import java.io.IOException;
import java.util.TimerTask;

import client.utility.PacketId.PacketID;
import client.view.Gui;


public class PositionAsker extends TimerTask{
	private Player player;
	private Gui gui;
	
	public PositionAsker(Player player, Gui gui) {
		this.player = player;
		this.gui = gui;
	}
	
	public void run() {
		try {
			player.getWriter().write(PacketID.position,player.getId());
			String line=player.getReader().readLine();
			
			String[] positions = line.split(";");
			player.updatePositions(positions);
			
			gui.updateData();
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	

}
